package com.randy.fundation;

import org.json.JSONObject;

public class JSONUtility {
    public static int getInt(JSONObject object, String key, int defaultValue) {
        if (object.has(key)) {
            try {
                return object.getInt(key);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return defaultValue;
    }

    public static String getString(JSONObject object, String key, String defaultValue) {
        if (object.has(key)) {
            try {
                return object.getString(key);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return defaultValue;
    }
}
